// Copyright 2024 The Google Research Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* Proto defining the format of messages exchanged by the client and servers.

TaskEvaluationRequest: task idx, input idx, eval_order, input

TaskEvaluationResponse: task idx, input idx, function value, gradient
*/

syntax = "proto3";

package third_party.google_research.google_research.es_maml.firs_order;

message TaskEvaluationRequest {
  int32 request_task_idx = 1;
  int32 input_idx = 2;
  int32 eval_order = 3;
  repeated double current_input = 4;
}

message TaskEvaluationResponse {
  int32 respond_task_idx = 1;
  int32 input_idx = 2;
  repeated double function_value = 3;
  repeated double gradient = 4;
}

/*
 This service method takes as an input the request from the client given as a
 task index and a current input vector for the optimization and returns the
 MAML gradient of the given task at the desired point.
*/
service Evaluation {
  // Returns MAML gradient for given task at current policy.
  rpc EvaluateBlackboxInput(TaskEvaluationRequest)
      returns (TaskEvaluationResponse) {}
}
